const { result } =require('../config/result')
const fs = require("fs");
const path = require("path");


const errorhandle = (err,ctx)=>{
  console.log("错误：",err)
  result.success = false;
  result.message = err;
  result.data = null;
  ctx.body = result;
}


const getteamdocTpluploadDir = ()=>{
  return path.join(__dirname, "/public/upload/teamdoc/tpl")
}
const getteamdocuploadDir = ()=>{
  return path.join(__dirname, "/public/upload/teamdoc")
}
const getExceluploadDir = ()=>{
  return path.join(__dirname, "/public/upload/excelData")
}

const getavatoruploadDir = ()=>{
  return path.join(__dirname, "/public/images")
}

const excelUploadDir=getExceluploadDir()
const avatorUploadDir=getavatoruploadDir()
const teamdocUploadDir=getteamdocuploadDir()
const teamdocTplUploadDir=getteamdocTpluploadDir()
module.exports = {
  errorhandle,
  excelUploadDir,
  avatorUploadDir,
  teamdocUploadDir,
  teamdocTplUploadDir
}